<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
    <!--<div class="head">
        <div class="headone"><i class="el-icon-menu"></i><span>检验标准</span></div>
    </div>-->
    <el-row class="header navbar bg-white">
        <div class="btn-group tool-button" style="line-height: 50px;">
            产品类型：<el-cascader clearable v-trim v-model="pageForm.productTypeCode" :props="{ checkStrictly: true }" placeholder="产品类型" :options="productTypeOptions" size="mini" style="width:180px;"></el-cascader>
            <!--<el-input placeholder="产品编号" v-trim v-model="pageForm.productNum"  size="mini" style="width:180px;"></el-input>-->
            产品名称：<el-input   placeholder="产品名称" v-trim v-model="pageForm.productName" size="mini" style="width:180px;"
                      clearable></el-input>
            检验依据标准：<el-input placeholder="检验依据标准" v-trim v-model="pageForm.inspectionStandard" size="mini" style="width:180px;"
                      clearable></el-input>
            <el-button slot="append" icon="el-icon-search" size="mini" @click="doSearch" circle></el-button>
            <!--<el-button slot="append" icon="el-icon-circle-close" size="mini" @click="restSearchForm" circle></el-button>-->
        </div>
        <div class="pull-right offscreen-right" style="margin-right: 20px;line-height: 50px;">
            <el-tooltip class="item" effect="dark" content="新增标准">
                <el-button type="primary" icon="el-icon-plus" size="mini" @click="openAddDialog" circle></el-button>
            </el-tooltip>
            <el-tooltip class="item" effect="dark" content="删除">
                <el-button type="danger" icon="el-icon-delete" size="mini" @click="batchCommand('{type:\'delete\'}')"
                           circle></el-button>
            </el-tooltip>
            <el-tooltip class="item" effect="dark" content="上传模板" v-if="isAdmin">
                <el-button type="primary" icon="el-icon-upload2" size="mini"
                           @click="uploadExcel" circle></el-button>
            </el-tooltip>
            <el-tooltip class="item" effect="dark" content="下载模板">
                <el-button type="primary" icon="el-icon-download" size="mini"
                           @click="downloadExcel" circle></el-button>
            </el-tooltip>
            <el-tooltip class="item" effect="dark" content="导入数据">
                <el-button type="primary" icon="el-icon-folder" size="mini" @click="importExcel"
                           circle></el-button>
            </el-tooltip>
        </div>
    </el-row>

    <el-row class="el-table-container">
        <el-table :data="tableData" @sort-change='pageOrder' height="520" border size="small" header-align="center"
                  style="width: 100%" @selection-change="handleSelectionChange">
            <el-table-column fixed="left" width="35" type="selection"></el-table-column>
            <!--<el-table-column sortable="custom" prop="unitName" label="所属科室" min-width="120px;" header-align="center" align="center" show-overflow-tooltip>
                <template slot-scope="scope" >{{scope.row.unitName}}</template>
            </el-table-column>-->
            <el-table-column sortable="custom" prop="producttypecode" label="产品类型" min-width="120px;" header-align="center"
                             align="center" show-overflow-tooltip>
                <template slot-scope="scope">
                    {{getDict(scope.row.producttypecode,allMap.yplxMap)}}
                </template>
            </el-table-column>
            <el-table-column sortable="custom" prop="productname" label="产品名称" min-width="120px;" header-align="center"
                             align="center" show-overflow-tooltip></el-table-column>
            <!--<el-table-column  sortable="custom" prop="productNum" label="产品编号" min-width="120px;" header-align="center" align="center" ></el-table-column>-->
            <el-table-column sortable="custom" prop="inspectionstandard" label="检验依据标准" min-width="140px;" header-align="center"
                             align="center" show-overflow-tooltip></el-table-column>
            <el-table-column sortable="custom" prop="disabled" label="状态" min-width="50px;" header-align="center" align="center">
                <template slot-scope="scope">
                    <i v-if="scope.row.disabled" class="fa fa-circle text-danger ml5"></i>
                    <i v-if="!scope.row.disabled" class="fa fa-circle text-success ml5"></i>
                </template>
            </el-table-column>
            <el-table-column
                    prop="note"
                    label="操作"
                    width="120">
                <template slot-scope="scope">
                    <el-dropdown @command="dropdownCommand">
                        <el-button size="mini">
                            <i class="ti-settings"></i>
                            <span class="ti-angle-down"></span>
                        </el-button>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item :command="{type:'viewReport',id:scope.row.id,row:scope.row}">
                                查看
                            </el-dropdown-item>
                            <el-dropdown-item divided :command="{type:'enable',id:scope.row.id,row:scope.row}">
                                启用
                            </el-dropdown-item>
                            <el-dropdown-item :command="{type:'disable',id:scope.row.id,row:scope.row}">
                                禁用
                            </el-dropdown-item>
                            <el-dropdown-item divided :command="{type:'edit',id:scope.row.id,row:scope.row}">
                                编辑
                            </el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </template>
            </el-table-column>
        </el-table>
    </el-row>
    <el-row class="el-pagination-container">
        <el-pagination @size-change="pageSizeChange" @current-change="pageNumberChange"
                       :current-page="pageForm.pageNumber" :page-sizes="[10, 20, 30, 50]"
                       :page-size="pageForm.pageSize" layout="total, sizes, prev, pager, next, jumper"
                       :total="pageForm.totalCount">
        </el-pagination>
    </el-row>

    <el-drawer :wrapperClosable="false" title="标准详情" :visible.sync="drawer" direction="rtl" size="80%" @opened="openIframe" destroy-on-close>
        <iframe id="iframeDetail" src="" width="100%" height="100%" frameborder="0" marginheight="0"></iframe>
    </el-drawer>

    <el-dialog :close-on-click-modal="false" append-to-body title="新建标准"
               :visible.sync="addDialogVisible" width="85%">
        <el-form id="addForm" :rules="formRules" :model="formData" ref="addForm" size="small" label-width="120px">
            <el-row :span="24" :gutter="20" align="center">
                <el-col :span="12">
                    <el-form-item prop="productName" label="产品名称" style="width: 60%">
                        <el-input :maxlength="100" placeholder="产品名称" v-trim v-model="formData.productName"
                                  type="text"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12" align="center">
                    <el-form-item prop="productTypeCode"  label="产品类型" style="width: 60%">
                        <!--<el-select v-trim v-model="formData.productTypeName" @change="changeSelectValue1"  placeholder="产品类型"
                                   style="width: 100%">
                            <el-option
                                    v-for="item in productTypeOptions"
                                    :key="item.code"
                                    :label="item.label"
                                    :value="item">
                            </el-option>
                        </el-select>-->
                        <el-cascader v-model="formData.productTypeCode"  placeholder="产品类型" :options="productTypeOptions" size="mini" style="width:180px;"></el-cascader>

                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :span="24" :gutter="20">
                <!--<el-col :span="12">-->
                <!--<el-form-item  label="所属科室" style="width: 60%">-->
                <!--<el-select v-trim v-model="formData.unitId" placeholder="所属科室" style="width: 100%">-->
                <!--<el-option  label="未移交" value="0"></el-option>-->
                <!--<el-option  label="已移交" value="1"></el-option>-->
                <!--</el-select>-->
                <!--</el-form-item>-->
                <!--</el-col>-->
                <el-col :span="24" align="left">
                    <!-- standard.inspectionStandard-->
                    <el-form-item prop="inspectionStandard" label="检验依据标准" style="width: 30%">
                        <el-input maxlength="100" placeholder="检验依据标准" v-trim v-model="formData.inspectionStandard"
                                  type="text"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-divider></el-divider>
            <el-row :span="12" style="margin-bottom: 20px;">
                <el-col :span="12" :offset="12" align="right">
                    <el-button size="small" type="primary" icon="el-icon-edit" @click="addInspectionItem">添加检验项目 </el-button>
                </el-col>
            </el-row>

            <!--<el-scrollbar id="itemScrollbar" style="height: 100%;">
                <el-row v-for="(item,index) in formData.inspectionItems" style="width: 150%;" :key="index" :span="24"
                        :gutter="3">
                    <el-col :span="1" align="center">
                        <el-button type="danger" icon="el-icon-delete" size="mini"
                                   @click="deleteInspectionItem(item, index)" circle></el-button>
                    </el-col>
                    <el-col :span="2">
                        <el-form-item :prop="'inspectionItems.'+index+'.inspectionItemName'"
                                      :rules="{required: true, message: '检验项目', trigger: ['blur', 'change']}">
                            <el-input size="mini" maxlength="150" placeholder="检验项目"
                                      v-trim v-model="item.inspectionItemName" type="text"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="1">
                        <el-form-item :prop="'inspectionItems.'+index+'.standardTermsNumber'" >
                            <el-input size="mini" maxlength="150" placeholder="条款号"
                                      v-model="item.standardTermsNumber"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="2">
                        <el-form-item :prop="'inspectionItems.'+index+'.specification'" >
                            <el-input size="mini" maxlength="150" placeholder="规格型号" v-trim v-model="item.specification"
                                      type="text"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="2">
                        <el-form-item :prop="'inspectionItems.'+index+'.sampleCount'"
                                      :rules="{ type: 'number', message: '样品数量(数字)', trigger: ['blur', 'change']}">
                            <el-input size="mini" maxlength="150" placeholder="样品数量" v-model="item.sampleCount"
                                      type="text"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="2">
                        <el-form-item :prop="'inspectionItems.'+index+'.inspectionPrice'"
                                      :rules="{ type: 'number', message: '检验费用(数字)', trigger: ['blur', 'change']}">
                            <el-input size="mini" maxlength="150" placeholder="检验费用" v-model="item.inspectionPrice"
                            type="text"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="2">
                        <el-form-item :prop="'inspectionItems.'+index+'.chargeStandardName'">
                            <el-select v-trim v-model="item.chargeStandardName"
                                       @change="changeSelectValue(index,'chargeStandardName','chargeStandardCode')"
                                       placeholder="收费标准" show size="mini" style="width: 100%">
                                <el-option
                                        v-for="map in chargeStandardOptions"
                                        :key="map.code"
                                        :label="map.label"
                                        :value="map">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="2">
                        <el-form-item :prop="'inspectionItems.'+index+'.countUnit'">
                            <el-input size="mini" maxlength="150" placeholder="计量单位" v-trim v-model="item.countUnit"
                                      type="text"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="2">
                        <el-form-item :prop="'inspectionItems.'+index+'.inspectionCycle'"
                                      :rules="{ required: true,message: '检验周期(天)', trigger: ['blur', 'change']}">
                            <el-input size="mini" maxlength="150" placeholder="检验周期(天)" v-trim v-model="item.inspectionCycle"
                                      type="text"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="2">
                        <el-form-item :prop="'inspectionItems.'+index+'.environmentStandard'">
                            <el-input size="mini" maxlength="150" placeholder="环境要求"
                                      v-trim v-model="item.environmentStandard" type="text"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="3">
                        <el-form-item :prop="'inspectionItems.'+index+'.equipmentName'">
                            <el-select v-trim v-model="item.equipmentName"
                                       @change="changeSelectValue(index,'equipmentName','equipmentCode')"
                                       placeholder="设备" show size="mini" style="width: 100%">
                                <el-option
                                        v-for="map in equipmentOptions"
                                        :key="map.code"
                                        :label="map.code+map.label"
                                        :value="map">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="2">
                        <el-form-item :prop="'inspectionItems.'+index+'.remark'">
                            <el-input size="mini" maxlength="150" placeholder="备注" v-trim v-model="item.remark"
                                      type="text"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="1" align="center">
                        <el-button type="danger" icon="el-icon-delete" size="mini"
                                   @click="deleteInspectionItem(item, index)" circle></el-button>
                    </el-col>
                </el-row>
            </el-scrollbar>-->
        </el-form>
        <el-form id="addFormTable" :rules="formRules" :model="formData" ref="tableForm" size="small" label-width="0px">
            <el-table :data="formData.inspectionItems" border style="width: 100%">
                <el-table-column prop="inspectionItemName" sortable="custom" label="检验项目" width="120">
                    <template slot-scope="scope">
                        <el-form-item  :prop="'inspectionItems.'+scope.$index+'.inspectionItemName'"
                                       :rules="{required: true, message: '检验项目', trigger: ['blur', 'change']}"
                                       >
                            <el-input size="mini" maxlength="150" placeholder="检验项目" v-trim v-model="scope.row.inspectionItemName" type="text"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column prop="inspectionItemOrder" sortable="custom" label="附页序号" width="150">
                    <template slot-scope="scope">
                        <el-form-item :prop="'inspectionItems.'+scope.$index+'.inspectionItemOrder'"
                                      :rules="{required: true, message: '附页序号', trigger: ['blur', 'change']}">
                            <el-input-number size="mini" maxlength="150" placeholder="附页序号"
                                             v-trim v-model="scope.row.inspectionItemOrder"></el-input-number>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column prop="standardTermsNumber" sortable="custom" label="条款号" width="120">
                    <template slot-scope="scope">
                        <el-form-item :prop="'inspectionItems.'+scope.$index+'.standardTermsNumber'" >
                            <el-input size="mini" maxlength="150" placeholder="条款号"
                                      v-trim v-model="scope.row.standardTermsNumber" ></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column prop="specification" sortable="custom"  label="规格型号" width="120">
                    <template slot-scope="scope">
                        <el-form-item :prop="'inspectionItems.'+scope.$index+'.specification'" >
                            <el-input size="mini" maxlength="150" placeholder="规格型号" v-trim v-model="scope.row.specification"
                                      type="text"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column prop="sampleCount" sortable="custom" label="样品数量" width="150">
                    <template slot-scope="scope">
                        <el-form-item :prop="'inspectionItems.'+scope.$index+'.sampleCount'"
                                      :rules="{ type: 'number', message: '样品数量(数字)', trigger: ['blur', 'change']}">
                            <el-input-number size="mini" maxlength="150" placeholder="样品数量" v-model="scope.row.sampleCount"
                                      type="text"></el-input-number>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column prop="inspectionPrice" sortable="custom"  label="检验费用" width="150">
                    <template slot-scope="scope">
                        <el-form-item :prop="'inspectionItems.'+scope.$index+'.inspectionPrice'"
                                      :rules="{ type: 'number', message: '检验费用(数字)', trigger: ['blur', 'change']}">
                            <el-input-number size="mini" maxlength="150" placeholder="检验费用" v-model="scope.row.inspectionPrice"
                                      type="text"></el-input-number>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column  prop="chargeStandardName" sortable="custom" label="收费标准" width="120">
                    <template slot-scope="scope">
                        <el-form-item :prop="'inspectionItems.'+scope.$index+'.chargeStandardName'">
                            <el-select v-trim v-model="scope.row.chargeStandardName"
                                       @change="changeSelectValue(scope.$index,'chargeStandardName','chargeStandardCode')"
                                       placeholder="收费标准" show size="mini" style="width: 100%">
                                <el-option
                                        v-for="map in chargeStandardOptions"
                                        :key="map.code"
                                        :label="map.label"
                                        :value="map">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column prop="countUnit" sortable="custom"  label="计量单位" width="120">
                    <template slot-scope="scope">
                        <el-form-item :prop="'inspectionItems.'+scope.$index+'.countUnit'">
                            <el-input size="mini" maxlength="150" placeholder="计量单位" v-trim v-model="scope.row.countUnit"
                                      type="text"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column prop="inspectionCycle" sortable="custom" label="检验周期(天)" width="150">
                    <template slot-scope="scope">
                        <el-form-item :prop="'inspectionItems.'+scope.$index+'.inspectionCycle'"
                                      :rules="{ required: true,message: '检验周期(天)', trigger: ['blur', 'change']}">
                            <el-input-number size="mini" maxlength="150" placeholder="检验周期(天)" v-trim v-model="scope.row.inspectionCycle"
                                      type="text"></el-input-number>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column prop="environmentStandard" sortable="custom" label="环境要求" width="120">
                    <template slot-scope="scope">
                        <el-form-item :prop="'inspectionItems.'+scope.$index+'.environmentStandard'">
                            <el-input size="mini" maxlength="150" placeholder="环境要求"
                                      v-trim v-model="scope.row.environmentStandard" type="text"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column  prop="equipmentCode" sortable="custom" label="设备编号" width="220">
                    <template slot-scope="scope">
                        <el-form-item :prop="'inspectionItems.'+scope.$index+'.equipmentCode'">
                            <el-input readonly maxlength="16" v-trim v-model="scope.row.equipmentCode" type="text" style="width: 120px" clearable></el-input>
                            <el-button type="primary" size="mini" @click="openEquipment(scope.$index)" plain>选择</el-button>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column label="备注" width="120">
                    <template slot-scope="scope">
                        <el-form-item :prop="'inspectionItems.'+scope.$index+'.remark'">
                            <el-input size="mini" maxlength="150" placeholder="备注" v-trim v-model="scope.row.remark"
                                      type="text"></el-input>
                        </el-form-item>
                    </template>
                </el-table-column>
                <el-table-column fixed="right" label="操作" width="100">
                    <template slot-scope="scope">
                        <el-button size="mini" type="danger" @click="deleteInspectionItem(scope.row,scope.$index)">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </el-form>
        <span slot="footer" class="dialog-footer">
            <el-button @click="addDialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="doAdd">确 定</el-button>
        </span>
    </el-dialog>


    <el-dialog :close-on-click-modal="false" append-to-body title="修改标准"
               :visible.sync="editDialogVisible" width="85%">
        <el-form id="editForm" :rules="formRules" :model="formData" ref="editForm" size="small" label-width="120px">
            <el-row :span="24" :gutter="20" align="center">
                <el-col :span="12">
                    <el-form-item prop="productName" label="产品名称" style="width: 60%">
                        <el-input :maxlength="100" placeholder="产品名称" v-trim v-model="formData.productName"
                                  type="text"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12" align="center">
                    <el-form-item prop="productTypeCode" label="产品类型" style="width: 60%">
                        <!--<el-select v-trim v-model="formData.productTypeName" @change="changeSelectValue1" placeholder="产品类型"
                                   style="width: 100%">
                            <el-option
                                    v-for="item in productTypeOptions"
                                    :key="item.code"
                                    :label="item.label"
                                    :value="item">
                            </el-option>
                        </el-select>-->
                        <el-cascader v-model="formData.productTypeCode" placeholder="产品类型" :options="productTypeOptions" size="mini" style="width:180px;"></el-cascader>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :span="24" :gutter="20">
                <!--<el-col :span="12">-->
                <!--<el-form-item  label="所属科室" style="width: 60%">-->
                <!--<el-select v-trim v-model="formData.unitId" placeholder="所属科室" style="width: 100%">-->
                <!--<el-option  label="未移交" value="0"></el-option>-->
                <!--<el-option  label="已移交" value="1"></el-option>-->
                <!--</el-select>-->
                <!--</el-form-item>-->
                <!--</el-col>-->
                <el-col :span="24" align="left">
                    <!-- standard.inspectionStandard-->
                    <el-form-item prop="inspectionStandard" label="检验依据标准" style="width: 30%">
                        <el-input maxlength="100" placeholder="检验依据标准" v-trim v-model="formData.inspectionStandard"
                                  type="text"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-divider></el-divider>
            <el-row :span="12" style="margin-bottom: 20px;">
                <el-col :span="12" :offset="12" align="right">
                    <el-button size="small" type="primary" icon="el-icon-edit" @click="addInspectionItem">添加检验项目
                    </el-button>
                </el-col>
            </el-row>

            <el-form id="addFormTable" :rules="formRules" :model="formData" ref="tableForm" size="small" label-width="0px">
                <el-table :data="formData.inspectionItems" border style="width: 100%">
                    <el-table-column prop="inspectionItemName" sortable="custom" label="检验项目" width="120">
                        <template slot-scope="scope">
                            <el-form-item  :prop="'inspectionItems.'+scope.$index+'.inspectionItemName'"
                                           :rules="{required: true, message: '检验项目', trigger: ['blur', 'change']}"
                            >
                                <el-input size="mini" maxlength="150" placeholder="检验项目" v-trim v-model="scope.row.inspectionItemName" type="text"></el-input>
                            </el-form-item>
                        </template>
                    </el-table-column>
                    <el-table-column prop="inspectionItemOrder" sortable="custom" label="附页序号" width="150">
                        <template slot-scope="scope">
                            <el-form-item :prop="'inspectionItems.'+scope.$index+'.inspectionItemOrder'"
                                          :rules="{required: true, message: '附页序号', trigger: ['blur', 'change']}">
                                <el-input-number size="mini" maxlength="150" placeholder="附页序号"
                                                 v-trim   v-model="scope.row.inspectionItemOrder"></el-input-number>
                            </el-form-item>
                        </template>
                    </el-table-column>
                    <el-table-column prop="standardTermsNumber" sortable="custom" label="条款号" width="120">
                        <template slot-scope="scope">
                            <el-form-item :prop="'inspectionItems.'+scope.$index+'.standardTermsNumber'" >
                                <el-input size="mini" maxlength="150" placeholder="条款号"
                                          v-trim  v-model="scope.row.standardTermsNumber"></el-input>
                            </el-form-item>
                        </template>
                    </el-table-column>
                    <el-table-column prop="specification" sortable="custom" label="规格型号" width="120">
                        <template slot-scope="scope">
                            <el-form-item :prop="'inspectionItems.'+scope.$index+'.specification'" >
                                <el-input size="mini" maxlength="150" placeholder="规格型号" v-trim v-model="scope.row.specification"
                                          type="text"></el-input>
                            </el-form-item>
                        </template>
                    </el-table-column>
                    <el-table-column prop="sampleCount" sortable="custom" label="样品数量" width="150">
                        <template slot-scope="scope">
                            <el-form-item :prop="'inspectionItems.'+scope.$index+'.sampleCount'"
                                          :rules="{ type: 'number', message: '样品数量(数字)', trigger: ['blur', 'change']}">
                                <el-input-number size="mini" maxlength="150" placeholder="样品数量" v-model="scope.row.sampleCount"
                                          type="text"></el-input-number>
                            </el-form-item>
                        </template>
                    </el-table-column>
                    <el-table-column prop="inspectionPrice" sortable="custom" label="检验费用" width="150">
                        <template slot-scope="scope">
                            <el-form-item :prop="'inspectionItems.'+scope.$index+'.inspectionPrice'"
                                          :rules="{ type: 'number', message: '检验费用(数字)', trigger: ['blur', 'change']}">
                                <el-input-number size="mini" maxlength="150" placeholder="检验费用" v-model="scope.row.inspectionPrice"
                                                 type="text"></el-input-number>
                            </el-form-item>
                        </template>
                    </el-table-column>
                    <el-table-column prop="chargeStandardName" sortable="custom" label="收费标准" width="120">
                        <template slot-scope="scope">
                            <el-form-item :prop="'inspectionItems.'+scope.$index+'.chargeStandardName'">
                                <el-select v-trim v-model="scope.row.chargeStandardName"
                                           @change="changeSelectValue(scope.$index,'chargeStandardName','chargeStandardCode')"
                                           placeholder="收费标准" show size="mini" style="width: 100%">
                                    <el-option
                                            v-for="map in chargeStandardOptions"
                                            :key="map.code"
                                            :label="map.label"
                                            :value="map">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </template>
                    </el-table-column>
                    <el-table-column prop="countUnit" sortable="custom" label="计量单位" width="120">
                        <template slot-scope="scope">
                            <el-form-item :prop="'inspectionItems.'+scope.$index+'.countUnit'">
                                <el-input size="mini" maxlength="150" placeholder="计量单位" v-trim v-model="scope.row.countUnit"
                                          type="text"></el-input>
                            </el-form-item>
                        </template>
                    </el-table-column>
                    <el-table-column prop="inspectionCycle" sortable="custom" label="检验周期(天)" width="150">
                        <template slot-scope="scope">
                            <el-form-item :prop="'inspectionItems.'+scope.$index+'.inspectionCycle'"
                                          :rules="{ required: true,message: '检验周期(天)', trigger: ['blur', 'change']}">
                                <el-input-number size="mini" maxlength="150" placeholder="检验周期(天)" v-trim v-model="scope.row.inspectionCycle"
                                                 type="text"></el-input-number>
                            </el-form-item>
                        </template>
                    </el-table-column>
                    <el-table-column prop="environmentStandard" sortable="custom" label="环境要求" width="120">
                        <template slot-scope="scope">
                            <el-form-item :prop="'inspectionItems.'+scope.$index+'.environmentStandard'">
                                <el-input size="mini" maxlength="150" placeholder="环境要求"
                                          v-trim v-model="scope.row.environmentStandard" type="text"></el-input>
                            </el-form-item>
                        </template>
                    </el-table-column>
                    <el-table-column prop="equipmentCode" sortable="custom" label="设备编号" width="220">
                        <template slot-scope="scope">
                            <el-form-item :prop="'inspectionItems.'+scope.$index+'.equipmentCode'">
                                <el-input readonly maxlength="16"v-trim v-model="scope.row.equipmentCode" type="text" style="width: 120px" clearable></el-input>
                                <el-button type="primary" size="mini" @click="openEquipment(scope.$index)" plain>选择</el-button>
                            </el-form-item>
                        </template>
                    </el-table-column>
                    <el-table-column label="备注" width="120">
                        <template slot-scope="scope">
                            <el-form-item :prop="'inspectionItems.'+scope.$index+'.remark'">
                                <el-input size="mini" maxlength="150" placeholder="备注" v-trim v-model="scope.row.remark"
                                          type="text"></el-input>
                            </el-form-item>
                        </template>
                    </el-table-column>
                    <el-table-column fixed="right" label="操作" width="100">
                        <template slot-scope="scope">
                            <el-button size="mini" type="danger" @click="deleteInspectionItem(scope.row,scope.$index)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-form>
        </el-form>
        <span slot="footer" class="dialog-footer">
            <el-button @click="editDialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="doEdit">确 定</el-button>
        </span>
    </el-dialog>

    <el-dialog title="选择设备" :visible.sync="visibleEquipment" width="80%"  append-to-body>
        <el-row class="bg-white">
            <div class="btn-group tool-button" style="line-height: 50px;">
                <el-input placeholder="设备编号" v-trim v-model="pageFormEquipment.code" size="mini" style="width:180px;" clearable></el-input>
                <el-input placeholder="设备名称" v-trim v-model="pageFormEquipment.name" size="mini" style="width:180px;" clearable></el-input>
                <el-button slot="append" icon="el-icon-search" size="mini" @click="doSearchEquipment" circle></el-button>
            </div>
        </el-row>
        <el-row>
            <el-table :data="tableDataEquipment" @sort-change='pageOrderEquipment' height="400"  border
                      ref="multipleTableEquipment" @select-all="selectAll" row-key="id"
                      size="small" header-align="center"  style="width: 100%" @selection-change="handleSelectionChangeEquipment">
                <el-table-column type="selection" reserve-selection="true" label="选择" width="55px;" header-align="center" align="center"></el-table-column>

                <el-table-column fixed="left" sortable="custom" prop="code" label="设备编号" width="120px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column fixed="left" sortable="custom" prop="name" label="设备名称" width="200px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="model" label="规格型号" width="120px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="detectionrange" label="检测范围" width="220px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="accuracy" label="精度要求" width="120px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="factorycode" label="出厂编号" width="120px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="number" label="数量（台/套）" min-width="130px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="company" label="制造厂商" min-width="120px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="purchaseprice" label="购置价格（元）" min-width="130px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="purchasedate" label="购置日期" min-width="120px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="calculate" label="计量方式" min-width="120px;" header-align="center" align="center" show-overflow-tooltip>
                    <template slot-scope="scope" >{{getDict(scope.row.calculate,allMap.calculateMap)}}</template>
                </el-table-column>
                <el-table-column sortable="custom" prop="calculateunit" label="计量单位" min-width="120px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="calculatecycle" label="计量周期" min-width="120px;" header-align="center" align="center" show-overflow-tooltip>
                    <template slot-scope="scope" >{{scope.row.calculatecycle}}{{getDict(scope.row.calculatecycletype,allMap.calculateCycleTypeMap)}}</template>
                </el-table-column>
                <el-table-column sortable="custom" prop="calculatedate" label="下次计量日期" min-width="120px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="depositadress" label="存放地点" min-width="220px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="managername" label="设备管理人" min-width="120px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="applyname" label="使用部门" min-width="120px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="classification" label="分类情况" min-width="120px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="importedflag" label="是否进口设备" min-width="120px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="assetcode" label="资产编号" min-width="120px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="supplyphone" label="供货商联系电话" min-width="150px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column sortable="custom" prop="remark" label="备注" min-width="320px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>

            </el-table>
        </el-row>
        <el-row class="el-pagination-container">
            <el-pagination @size-change="pageSizeChangeEquipment" @current-change="pageNumberChangeEquipment" :current-page="pageFormEquipment.pageNumber" :page-sizes="[10, 20, 30, 50]"
                           :page-size="pageFormEquipment.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="pageFormEquipment.totalCount">
            </el-pagination>
        </el-row>

        <span slot="footer" class="dialog-footer">
            <el-button @click="visibleEquipment = false">取 消</el-button>
            <el-button type="primary" @click="setEquipment">确 定</el-button>
        </span>
    </el-dialog>


    <el-dialog :close-on-click-modal="false" append-to-body style="margin-left: 160px;"  title="选择excel文件"  :visible.sync="excelDialogVisible" width="500px">
        <el-upload
                class="upload-demo"
                action="${base}/open/file/upload/file1"
                name="Filedata"
                multiple
                :limit="1"
                :before-upload="beforeOfficeUpload"
                :on-success="function(resp,file,fileList){return handleOfficeSuccess(resp,file,fileList)}"
                :on-progress="uploadFileProcess"
                :file-list="fileList"
        >
            <el-button size="small" type="primary">点击上传</el-button>
            <div slot="tip" class="el-upload__tip">只能上传xlsx文件</div>
        </el-upload>

        <span slot="footer" class="dialog-footer">
            <el-button @click="excelDialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="doExcel">确 定</el-button>
        </span>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" append-to-body style="margin-left: 160px;"  title="选择excel模板"  :visible.sync="uploadExcelVisible" width="500px">
        <el-upload
                class="upload-demo"
                action="${base}/open/file/upload/file1"
                name="Filedata"
                multiple
                :limit="1"
                :before-upload="beforeOfficeUpload"
                :on-success="function(resp,file,fileList){return handleOfficeSuccess(resp,file,fileList)}"
                :on-progress="uploadFileProcess"
                :file-list="fileList"
        >
            <el-button size="small" type="primary">点击上传</el-button>
            <div slot="tip" class="el-upload__tip">只能上传xlsx文件</div>
        </el-upload>

        <span slot="footer" class="dialog-footer">
            <el-button @click="uploadExcelVisible = false">取 消</el-button>
            <el-button type="primary" @click="upExcel">上 传</el-button>
        </span>
    </el-dialog>
</div>
<style scoped>
    .el-table--border th.gutter:last-of-type {
        display: block !important;
        width: 17px !important;
    }

    #itemScrollbar div.el-form-item__content {
        margin-left: 0px !important;
    }
    input[type=file]{
        display: none;
    }
</style>
<script>
    var allMap = {yplxMap:${yplxMap}};
    var isAdmin = ${isAdmin}
    new Vue({
        el: "#app",
        data: function () {
            return {
                allMap:allMap,
                isAdmin:isAdmin,
                tableData: [],
                menuOptions: [],
                addDialogVisible: false,
                editDialogVisible:false,
                drawer: false,
                pageForm: {},
                detailURL: "",
                formData: {
                    productName: '',
                    productTypeCode: '',
                    productTypeName: '',
                    inspectionStandard: '',
                    inspectionItems: [{
                        inspectionItemName: '',
                        standardTermsNumber: '',
                        specification: '',
                        sampleCount: '',
                        inspectionPrice: '',
                        chargeStandardCode: '',
                        chargeStandardName: '',
                        countUnit: '',
                        inspectionCycle: '',
                        environmentStandard: '',
                        equipmentCode: '',
                        equipmentName: '',
                        remark: ''
                    }]
                },
                formRules: {
                    productName: [{required: true, message: '产品名称', trigger: ['blur', 'change']}],
                    productTypeCode: [{required: true, message: '产品类型', trigger: ['blur', 'change']}],
                    productTypeName: [{required: true, message: '产品类型', trigger: ['blur', 'change']}],
                    inspectionStandard: [{required: true, message: '检测标准', trigger: ['blur', 'change']}],
                },
                productTypeOptions: [],
                chargeStandardOptions: [],
                equipmentOptions: [],
                multipleSelection: [],

                tableDataEquipment: [],
                pageFormEquipment: {},
                visibleEquipment:false,
                equipmentIndex:0,
                multipleSelectionEquipment:[],
                excelDialogVisible:false,
                uploadExcelVisible:false,
                fileList:[],
                fileId:"",
            }
        },
        methods: {
            formatAt: function (val) {
                if (val > 0)
                    return moment(val * 1000).format("YYYY-MM-DD HH:mm");
                return "";
            },
            doAdd: function () {
                var self = this;
                self.$refs["addForm"].validate(function (valid) {
                    if (valid) {
                        self.$refs["tableForm"].validate(function (valid) {
                            if (valid) {
                        /*      {
                                  standard:JSON.stringify(self.formData),
                                  // inspectionItems:JSON.stringify(self.formData.inspectionItems)
                              },*/
                                if(nONull(self.formData.productTypeCode)){self.formData.productTypeCode=self.formData.productTypeCode.join(",");}
                                $.post(base + "/platform/bus/ins_standard/addDo", {standard: JSON.stringify(self.formData)}, function (data) {
                                    if (data.code == 0) {
                                        self.$message({
                                            message: data.msg,
                                            type: 'success'
                                        });
                                        self.addDialogVisible = false;
                                    } else {
                                        self.$message({
                                            message: data.msg,
                                            type: 'error'
                                        });
                                    }
                                    self.pageData();//添加失败也可以入库,所以加载一下看看
                                }, "json");
                            }
                        });
                    }
                });
            },
            doEdit: function () {
                var self = this;
                //console.log(this.formData.inspectionItems)
                self.$refs["editForm"].validate(function (valid) {
                    if (valid) {//表单验证通过
                        self.$refs["tableForm"].validate(function (valid) {
                            if (valid) {
                                if(nONull(self.formData.productTypeCode)){self.formData.productTypeCode=self.formData.productTypeCode.join(",");}
                                $.post(base + "/platform/bus/ins_standard/editDo", {standard: JSON.stringify(self.formData)}, function (data) {
                                    if (data.code == 0) {
                                        self.$message({
                                            message: data.msg,
                                            type: 'success'
                                        });
                                        self.editDialogVisible = false;
                                    } else {
                                        self.$message({
                                            message: data.msg,
                                            type: 'error'
                                        });
                                    }
                                    self.pageData();//添加失败也可以入库,所以加载一下看看
                                }, "json");
                            }
                        });
                    }
                });
            },
            initProductTypeOptions: function () {
                var self = this;
                $.post(base + "/platform/sys/dict/dictCodeTree", {'code': 'yplx'}, function (data) {
                    if (data.code == 0) {
                        self.productTypeOptions = data.data;
                    } else {
                        self.$message({
                            message: "获取产品类型失败",
                            type: 'error'
                        });
                    }
                }, "json");
            },
            initChargeStandardOptions: function () {
                var self = this;
                $.post(base + "/platform/sys/dict/dictTree", {'code': 'charge_standard'}, function (data) {
                    if (data.code == 0) {
                        self.chargeStandardOptions = data.data;
                    } else {
                        self.$message({
                            message: "获取收费标准失败",
                            type: 'error'
                        });
                    }
                }, "json");
            },

            initEquipmentOptions: function () {
                var self = this;
                $.post(base + "/platform/bus/equipment/data", {}, function (data) {
                    if (data.code == 0) {
                        self.equipmentOptions = data.data;
                    } else {
                        self.$message({
                            message: "获取设备列表失败",
                            type: 'error'
                        });
                    }
                }, "json");
            },

            changeSelectValue: function (index, val1, val2) {
                var self = this;
                var object = self.formData.inspectionItems[index][val1];
                self.formData.inspectionItems[index][val1] = object.label;
                self.formData.inspectionItems[index][val2] = object.code;
            },
            openAddDialog: function () {
                if (this.$refs["addForm"]) this.$refs["addForm"].resetFields();

                this.formData= {
                    productName: '',
                        productTypeCode: '',
                        productTypeName: '',
                        inspectionStandard: '',
                        inspectionItems: [{
                        inspectionItemName: '',
                        standardTermsNumber: '',
                        specification: '',
                        sampleCount: '',
                        inspectionPrice: '',
                        chargeStandardCode: '',
                        chargeStandardName: '',
                        countUnit: '',
                        inspectionCycle: '',
                        environmentStandard: '',
                        equipmentCode: '',
                        equipmentName: '',
                        remark: ''
                    }]
                }
                this.addDialogVisible = true;
            },
            openIframe: function () {
                $("#iframeDetail").attr("src", this.detailURL);
            },
            addInspectionItem: function () {
                this.formData.inspectionItems.push({
                    inspectionItemName: '',
                    standardTermsNumber: '',
                    specification: '',
                    sampleCount: '',
                    inspectionPrice: '',
                    chargeStandardCode: '',
                    chargeStandardName: '',
                    countUnit: '',
                    inspectionCycle: '',
                    environmentStandard: '',
                    equipmentCode: '',
                    equipmentName: '',
                    remark: ''
                })
            },
            deleteInspectionItem: function (item, index) {
                /*this.index = this.formData.inspectionItems.indexOf(item)
                if (index !== -1) {
                    this.formData.inspectionItems.splice(index, 1)
                }*/
                var self = this;
                if(item.id){
                    self.$confirm('此操作将删除项目：' + item.inspectionItemName, '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning',
                        callback: function (a, b) {
                            if ("confirm" == a) {//确认后再执行
                                $.post(base + "/platform/bus/ins_standard/itemDelete/" + item.id, {}, function (data) {
                                    if (data.code == 0) {
                                        self.$message({message: data.msg,type: 'success'});
                                        self.formData.inspectionItems.splice(index, 1);
                                    } else {
                                        self.$message({message: data.msg,type: 'error'});
                                    }
                                }, "json");
                            }
                        }
                    });
                }else{
                    self.formData.inspectionItems.splice(index, 1);
                }
            },

            pageOrder: function (column) {//按字段排序
                this.pageForm.pageOrderName = column.prop;
                this.pageForm.pageOrderBy = column.order;
                this.pageData();
            },
            pageNumberChange: function (val) {//页码更新操作
                this.pageForm.pageNumber = val;
                this.pageData();
            },
            pageSizeChange: function (val) {//分页大小更新操作
                this.pageForm.pageSize = val;
                this.pageData();
            },
            pageData: function () {//加载分页数据
                var self = this;
                if(nONull(self.pageForm.productTypeCode)){self.pageForm.productTypeCode=self.pageForm.productTypeCode.join(",");}
                sublime.showLoadingbar();//显示loading
                $.post(base + "/platform/bus/ins_standard/data", self.pageForm, function (data) {
                    sublime.closeLoadingbar();//关闭loading
                    if (data.code == 0) {
                        self.tableData = data.data.list;
                        self.pageForm.totalCount = data.data.totalCount;
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                    if(nONull(self.pageForm.productTypeCode)){self.pageForm.productTypeCode=self.pageForm.productTypeCode.split(",");}
                }, "json");
            },
            doSearch: function () {
                this.pageForm.pageNumber = 1;
                this.pageData();
            },
            batchCommand: function (command) {
                if (typeof (command) == "string") {
                    command = eval('(' + command + ')');
                }
                var self = this;
                if ("delete" == command.type) {
                    if (self.multipleSelection.length == 0) {
                        self.$message({
                            message: "请选择要删除的数据",
                            type: 'warning'
                        });
                    } else {
                        var inspectionStandards = [];
                        var ids = [];
                        self.multipleSelection.forEach(function (val) {
                            ids.push(val.id);
                            inspectionStandards.push(val.inspectionstandard);
                        });
                        if ("delete" == command.type) {
                            self.$confirm('此操作将删除 ' + inspectionStandards.toString(), '提示', {
                                confirmButtonText: '确定',
                                cancelButtonText: '取消',
                                type: 'warning',
                                callback: function (a, b) {
                                    if ("confirm" == a) {//确认后再执行
                                        $.post(base + "/platform/bus/ins_standard/batch/delete/", {ids: ids.toString()}, function (data) {
                                            if (data.code == 0) {
                                                self.$message({
                                                    message: data.msg,
                                                    type: 'success'
                                                });
                                                self.doSearch();
                                            } else {
                                                self.$message({
                                                    message: data.msg,
                                                    type: 'error'
                                                });
                                            }
                                        }, "json");
                                    }
                                }
                            });
                        }
                    }
                }
            },
            dropdownCommand: function (command) {//监听下拉框事件
                var self = this;
                if ("enable" == command.type || "disable" == command.type) {
                    $.post(base + "/platform/bus/ins_standard/" + command.type + "/" + command.id, {}, function (data) {
                        if (data.code == 0) {
                            self.$message({
                                message: data.msg,
                                type: 'success'
                            });
                            if ("disable" == command.type) {
                                command.row.disabled = true;
                            }
                            if ("enable" == command.type) {
                                command.row.disabled = false;
                            }
                        } else {
                            self.$message({
                                message: data.msg,
                                type: 'error'
                            });
                        }
                    }, "json");
                }

                if ("edit" == command.type) {
                    $.get(base + "/platform/bus/ins_standard/edit/" + command.id, function (data) {
                        if (data.code == 0) {
                            self.formData = data.data;//加载后台表单数据
                            self.editDialogVisible = true;//打开编辑窗口
                            if(nONull(self.formData.productTypeCode)){self.formData.productTypeCode=self.formData.productTypeCode.split(",");}
                            self.formData = JSON.parse(JSON.stringify(self.formData))
                        } else {
                            self.$message({
                                message: data.msg,
                                type: 'error'
                            });
                        }
                    }, "json");
                }

                if ("viewReport" == command.type) {
                    this.drawer = true;
                    this.detailURL = "/platform/bus/ins_standard/view/" + command.id;
                }

            },
            handleSelectionChange: function (val) {
                this.multipleSelection = val;
            },
            getDict: function (val, map) {
                if (val != null && val != undefined && val != "" && map != null && map != undefined) {
                    var str = val.split(",");
                    var strname = "";
                    for (var a = 0; a < str.length; a++) {
                        strname += map[str[a]];
                        if (strname == null) {
                            alert(1)
                        }
                        if (a < (str.length - 1)) {
                            strname += "/";
                        }
                    }
                    return strname;
                }
                return "";
            },

            openEquipment:function(index){
                this.multipleSelectionEquipment=[];
                this.visibleEquipment = true;
                this.equipmentIndex = index;
                this.doSearchEquipment();
                this.$nextTick(() => {
                    this.$refs.multipleTableEquipment.clearSelection();
                });
            },
            selectAll(){
                //this.$refs.multipleTableEquipment.clearSelection();
            },
            handleSelectionChangeEquipment: function (val) {
                //this.$refs.multipleTableEquipment.toggleRowSelection(val);
                /*val.forEach((item,index)=>{
                    //console.log(val.length,index,item.name)
                    if(index<val.length-1){
                        val.splice(index,1)
                        this.$refs.multipleTableEquipment.toggleRowSelection(item,false);
                    }
                })*/
                //console.log(val,"--------------")
                this.multipleSelectionEquipment=val;
                //this.visibleEquipment = false;
            },
            setEquipment:function(){
                var self = this;
                if(self.multipleSelectionEquipment.length==0){
                    self.$message({message: "请选择设备！",type: 'error'});
                    return;
                }
                var equipment = self.multipleSelectionEquipment;
                var code = ""
                if(equipment.length>0){
                    equipment.forEach((item,index)=>{
                        //console.log(val.length,index,item.name)
                        code+=item.code+",";
                    })
                    code=code.substring(0,code.length-1)
                    self.formData.inspectionItems[self.equipmentIndex].equipmentCode = code;
                }
                self.formData = JSON.parse(JSON.stringify(self.formData))
                /*self.formData.inspectionItems[self.equipmentIndex].equipmentId=equipment.id;
                self.formData.inspectionItems[self.equipmentIndex].equipmentName=equipment.name;*/
                self.visibleEquipment = false;
            },
            pageOrderEquipment: function (column) {//按字段排序
                this.pageFormEquipment.pageOrderName = column.prop;
                this.pageFormEquipment.pageOrderBy = column.order;
                this.pageDataEquipment();
            },
            pageNumberChangeEquipment: function (val) {//页码更新操作
                this.pageFormEquipment.pageNumber = val;
                this.pageDataEquipment();
            },
            pageSizeChangeEquipment: function (val) {//分页大小更新操作
                this.pageFormEquipment.pageSize = val;
                this.pageDataEquipment();
            },
            pageDataEquipment: function () {//加载分页数据
                var self = this;
                sublime.showLoadingbar();//显示loading
                $.post(base + "/platform/bus/equipment/data", self.pageFormEquipment, function (data) {
                    sublime.closeLoadingbar();//关闭loading
                    if (data.code == 0) {
                        self.tableDataEquipment = data.data.list;
                        self.pageFormEquipment.totalCount = data.data.totalCount;
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                }, "json");
            },
            doSearchEquipment: function () {
                this.pageFormEquipment.pageNumber = 1;
                this.pageDataEquipment();
            },
            uploadExcel(){
                this.uploadExcelVisible=true;
                this.fileList=[];
            },
            downloadExcel(){
                //
                var self = this;
                $.post(base + "/platform/bus/ins_standard/downExcel", {}, function (data) {
                    sublime.closeLoadingbar();//关闭loading
                    if (data.code == 0) {
                        self.$message({
                            message: data.msg,
                            type: 'success'
                        });
                        window.open("${AppFileDomain}${AppUploadBase}"+data.data.filePath);
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                }, "json");
            },
            upExcel(){
                var self = this;
                sublime.showLoadingbar();//显示loading
                $.post(base + "/platform/bus/ins_standard/upExcel/", {fileId:self.fileId}, function (data) {
                    sublime.closeLoadingbar();//关闭loading
                    if (data.code == 0) {
                        self.$message({
                            message: data.msg,
                            type: 'success'
                        });
                        self.uploadExcelVisible=false;
                        self.fileList=[];
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                }, "json");
            },
            importExcel(){
                this.excelDialogVisible=true;
                this.fileList=[];
            },
            beforeOfficeUpload: function (file) {
                //var isLt5M = file.size / 1024 / 1024 < 5;
                var type= file.name.substring(file.name.lastIndexOf("."), file.name.length);
                this.$set(this.formData, "fileBeforeName",file.name);
                if (!(".xlsx" ==type)) {
                    this.$message.error('请上传正确的模板文件，后缀应为xlsx格式');
                    return false;
                }
                return true;
            },
            handleOfficeSuccess: function (response, file, fileList) {
                this.fileId = response.data.id;
                this.fileUploadFlag=false;
            },
            //进度条
            uploadFileProcess:function(event, file, fileList){
                this.fileUploadFlag=true;
                this.fileUploadPercent = parseInt(event.percent);
            },
            doExcel(){
                var self = this;
                sublime.showLoadingbar();//显示loading
                $.post(base + "/platform/bus/ins_standard/importExcel/"+this.fileId, {}, function (data) {
                    sublime.closeLoadingbar();//关闭loading
                    if (data.code == 0) {
                        self.$message({
                            message: data.msg,
                            type: 'success'
                        });
                        self.excelDialogVisible=false;
                        self.fileList=[];
                        self.pageData();
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                }, "json");
            }
        },
        created: function () {
            this.initProductTypeOptions();
            this.initChargeStandardOptions();
            this.initEquipmentOptions();
            this.doSearch();
        }
    });

    function nONull(val) {
        if (val != null && val != undefined && val != "") {
            return true;
        } else {
            return false;
        }
    }
</script>
<!--#
}
#-->
